package com.eva.statDemo.stat;

import android.app.ActivityManager;
import android.content.Context;
import android.util.Log;

/**
 * Created by Jiangjia on 2015/9/15.
 */

public class Debuger {

    private static final boolean DEBUG = true;

    private static final String TAG = "STAT";

    public static void LOGD(String str) {
        if (!DEBUG) return;
        Log.d(TAG, str);
    }

    public static String getProcessName(Context context) {
        int pid = android.os.Process.myPid();
        ActivityManager mgr = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        for (ActivityManager.RunningAppProcessInfo appProcess : mgr.getRunningAppProcesses()) {
            if (appProcess.pid == pid) {
                return appProcess.processName;
            }
        }
        return null;
    }
}
